package com.example.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.domain.ResponseResult;
import com.example.domain.entity.Order;
import com.example.exception.FloraException;
import com.example.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@ResponseBody
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/allOrder")
    public IPage<Order> getAllOrderList(Long orderId, Integer pageNum, Integer pageSize) throws FloraException {
        return orderService.getOrder(orderId,pageNum,pageSize);
    }

    @PostMapping("/addOrder")
    public Order addOrder(@RequestBody Order order) throws FloraException {
        return orderService.addOrder(order);
    }

    @DeleteMapping("/deleteComment")
    public void deleteOrder(Long orderId) throws FloraException {
        orderService.deleteOrder(orderId);
    }

}
